package com.lishe.lishe.lishe.module.me.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.RelativeLayout;

import com.lishe.lishe.R;
import com.lishe.lishe.asynchttp.LSWebHelper;
import com.lishe.lishe.lishe.module.me.http.HttpUserCenter;

import org.json.JSONObject;

/**
 * Created by zhcasecom on 2017/8/17.
 * 优惠券
 */

public class FragmentCoupons extends Fragment {
    private static final String TAG = FragmentCoupons.class.getSimpleName();
    private RelativeLayout icon_container;
    private ListView coupons_listView;

    public static FragmentCoupons newInstance() {
        FragmentCoupons instance = new FragmentCoupons();
        Bundle bundle = new Bundle();
        instance.setArguments(bundle);
        return instance;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_my_coupons, container, false);
        coupons_listView = view.findViewById(R.id.coupons_list);
        icon_container = view.findViewById(R.id.picture_no_coupons);
        return view;
    }

    private void initData() {

        try {
            HttpUserCenter.getCoupons(null, response);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    LSWebHelper.WebCallBack response = new LSWebHelper.WebCallBack() {
        @Override
        public void onSuccess(JSONObject dataJson, String dataString, String message) {
            String data = dataString;
            Log.e(TAG, "Coupons——————data:" + data);
        }

        @Override
        public void onFailure(String message) {
        }
    };

    @Override
    public void onResume() {
        super.onResume();
        initData();
    }

    @Override
    public void onStop() {
        super.onStop();
    }
}
